package main

import (
	"fmt"
	"go_dev/day5/homework4/random"
)

func insert(s []int){
	l := len(s)
	for i := 1; i < l; i++ {
		tmp := s[i]
		for j := i-1; j >= 0; j-- {
			if tmp < s[j] {
				s[j], s[j+1] = s[j+1], s[j]
			} else {
				s[j+1] = tmp
				break
			}
		}
		fmt.Println(s)
	}
}

func main(){
	s := random.RandSlice(20)
	fmt.Println(s)
	insert(s)
	fmt.Println(s)
}